<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
 <head>
  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  <title>Create a new paradox object</title>
 </head>
 <body class="docs"><div id="layout">
  <div id="layout-content"><div id="function.px-new" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">px_new</h1>
  <p class="verinfo">(PECL paradox &gt;= 1.0.0)</p><p class="refpurpose"><span class="refname">px_new</span> &mdash; <span class="dc-title">Create a new paradox object</span></p>

 </div>

 <div class="refsect1 description" id="refsect1-function.px-new-description">
  <h3 class="title">说明</h3>
  <div class="methodsynopsis dc-description">
   <span class="methodname"><strong>px_new</strong></span>
    ( <span class="methodparam">void</span>
   ) : <span class="type">resource</span></div>

  <p class="para rdfs-comment">
   Create a new paradox object. You will have to call this function before any
   further functions. <span class="function"><strong>px_new()</strong></span> does not create any file on
   the disk, it just creates an instance of a paradox object. This function
   must not be called if the object oriented interface is used. Use <em>new
   paradox_db()</em> instead.
  </p>
 </div>


 <div class="refsect1 returnvalues" id="refsect1-function.px-new-returnvalues">
  <h3 class="title">返回值</h3>
  <p class="para">
   Returns <strong><code>FALSE</code></strong> on failure.
  </p>
 </div>



 <div class="refsect1 examples" id="refsect1-function.px-new-examples">
  <h3 class="title">范例</h3>
  <p class="para">
   <div class="example" id="example-2468">
    <p><strong>Example #1 Opening a Paradox database</strong></p>
    <div class="example-contents">
<div class="phpcode"><pre><span style="color: #000000">
<span style="color: #0000BB">&lt;?php<br /></span><span style="color: #007700">if(!</span><span style="color: #0000BB">$pxdoc&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">px_new</span><span style="color: #007700">())&nbsp;{<br />&nbsp;&nbsp;</span><span style="color: #FF8000">/*&nbsp;Error&nbsp;handling&nbsp;*/<br /></span><span style="color: #007700">}<br /></span><span style="color: #0000BB">$fp&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">fopen</span><span style="color: #007700">(</span><span style="color: #DD0000">"test.db"</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">"r"</span><span style="color: #007700">);<br />if(!</span><span style="color: #0000BB">px_open_fp</span><span style="color: #007700">(</span><span style="color: #0000BB">$pxdoc</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">$fp</span><span style="color: #007700">))&nbsp;{<br />&nbsp;&nbsp;</span><span style="color: #FF8000">/*&nbsp;Error&nbsp;handling&nbsp;*/<br /></span><span style="color: #007700">}<br /></span><span style="color: #FF8000">//&nbsp;...<br /></span><span style="color: #0000BB">px_close</span><span style="color: #007700">(</span><span style="color: #0000BB">$pxdoc</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">px_delete</span><span style="color: #007700">(</span><span style="color: #0000BB">$pxdoc</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">fclose</span><span style="color: #007700">(</span><span style="color: #0000BB">$fp</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">?&gt;</span>
</span>
</pre></div>
    </div>

   </div>
  </p>
  <p class="para">
   If you prefer the object oriented API, then the above example will look
   like the following.
   <div class="example" id="example-2469">
    <p><strong>Example #2 Opening a Paradox database</strong></p>
    <div class="example-contents">
<div class="phpcode"><pre><span style="color: #000000">
<span style="color: #0000BB">&lt;?php<br />$fp&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">fopen</span><span style="color: #007700">(</span><span style="color: #DD0000">"test.db"</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">"r"</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">$pxdoc&nbsp;</span><span style="color: #007700">=&nbsp;new&nbsp;</span><span style="color: #0000BB">paradox_db</span><span style="color: #007700">();<br />if(!</span><span style="color: #0000BB">$pxdoc</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">open_fp</span><span style="color: #007700">(</span><span style="color: #0000BB">$fp</span><span style="color: #007700">))&nbsp;{<br />&nbsp;&nbsp;</span><span style="color: #FF8000">/*&nbsp;Error&nbsp;handling&nbsp;*/<br /></span><span style="color: #007700">}<br /></span><span style="color: #FF8000">//&nbsp;...<br /></span><span style="color: #0000BB">$pxdoc</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">close</span><span style="color: #007700">();<br /></span><span style="color: #0000BB">fclose</span><span style="color: #007700">(</span><span style="color: #0000BB">$fp</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">?&gt;</span>
</span>
</pre></div>
    </div>

   </div>
  </p>
 </div>


 <div class="refsect1 seealso" id="refsect1-function.px-new-seealso">
  <h3 class="title">参见</h3>
  <p class="para">
   <ul class="simplelist">
    <li class="member"><span class="function"><a href="px_delete.html" class="function" rel="rdfs-seeAlso">px_delete()</a> - Deletes resource of paradox database</span></li>
    <li class="member"><span class="function"><a href="px_open_fp.html" class="function" rel="rdfs-seeAlso">px_open_fp()</a> - Open paradox database</span></li>
   </ul>
  </p>
 </div>


</div></div></div></body></html>